

jQuery(document).ready(function() {
	$('#buscarCop').hide();

	$.ajax({
		url : 'cargaDashboard', // action to be perform
		dataType : 'html',
		success : function(html) {
			;
			$('#contenidoInformacion').html(html); // set result.jsp output to leftDiv
		},
		error : function(xhr, ajaxOptions, thrownError) {
			alert('An error occurred! ' + thrownError);
		},
	});

	$('#implements').click(function() {
		$.ajax({
			url : 'implement', // action to be perform
			type : 'GET',
			data : {
				direccionAction : '7'
			},
			dataType : 'html',
			success : function(html) {
				$('#contenidoInformacion').html(html); // set result.jsp output to leftDiv
			},
			error : function(xhr, ajaxOptions, thrownError) {
				alert('An error occurred! ' + thrownError);
			},
		});
		$('#transitions').removeClass("active");
		$('#cop').removeClass("active");
		$('#implements').addClass("active");
	});

	$('#transitions').click(function() {
		$('#contenidoInformacion').empty();
		$.ajax({
			url : 'cargaTransition', // action to be perform
			type:'GET',
			dataType : 'html',
			success : function(html) {
				
				$('#contenidoInformacion').html(html); // set result.jsp output to leftDiv
			},
			error : function(xhr, ajaxOptions, thrownError) {
				alert('An error occurred! ' + thrownError);
			},
		});
		$('#implements').removeClass("active");
		$('#cop').removeClass("active");
		$('#transitions').addClass("active");
	});
	
	$('#dashboard').click(function() {
		$.ajax({
			url : 'cargaDashboard', // action to be perform
			type:'GET',
			dataType : 'html',
			success : function(html) {
				
				$('#contenidoInformacion').html(html); // set result.jsp output to leftDiv
			},
			error : function(xhr, ajaxOptions, thrownError) {
				alert('An error occurred! ' + thrownError);
			},
		});
		$('#implements').removeClass("active");
		$('#transitions').removeClass("active");
		$('#cop').removeClass("active");
		$('#foro').removeClass("active");
	});
	
	$('#cop').click(function() {
		$.ajax({
			url : 'cop', // action to be perform
			data : {
				exportar : false
			},
			dataType : 'html',
			success : function(html) {
				$('#contenidoInformacion').html(html); // set result.jsp output to leftDiv
			},
			error : function(xhr, ajaxOptions, thrownError) {
				alert('An error occurred! ' + thrownError);
			},
		});
		$('#implements').removeClass("active");
		$('#transitions').removeClass("active");
		$('#cop').addClass("active");
	});
	
	$('#creationcomp').click(function() {
		$.ajax({
			url : 'creationcompany', // action to be perform
			dataType : 'html',
			success : function(html) {
				$('#contenidoInformacion').html(html); // set result.jsp output to leftDiv
			},
			error : function(xhr, ajaxOptions, thrownError) {
				alert('An error occurred! ' + thrownError);
			},
		});
	});

});

var searchClientKn = function() {
	$.ajax({
		url : 'searchKnKey', // action to be perform
		dataType : 'html',
		data : {
			knkey : $("#knkey").val()
		},
		success : function(html) {
			$('#contenidoKn').html(html); // set result.jsp output to leftDiv
		},
		error : function(xhr, ajaxOptions, thrownError) {
			alert('An error occurred! ' + thrownError);
		},
	});
};

var searchCopCompany = function(){
	$( "#buscarCop" ).dialog({
		 modal: true,
		 width: 800,
		 height: 600,
		 position: ['center', 'top'],
		 show: {
			 effect: "blind",
			 duration: 1000
			 },
		hide: {
			 effect: "explode",
			 duration: 1000
			 }
	});
	$.ajax({
		url : 'searchCopCompany', // action to be perform
		dataType : 'html',
		data : {
			copCompanyName : $("#copCompanyText").val()
		},
		success : function(html) {
			$('#contenidoBusquedaCop').html(html); // set result.jsp output to leftDiv
		},
		error : function(xhr, ajaxOptions, thrownError) {
			alert('An error occurred! ' + thrownError);
		},
	});	
	
	
	$('#buscarCop').dialog();
	$("#buscarCop").show();
};


	

var opcForo = function() {
	$.ajax({
		url : 'foro', // action to be perform
		dataType : 'html',
		success : function(html) {
			
			$('#contenidoInformacion').html(html); // set result.jsp output to leftDiv
		},
		error : function(xhr, ajaxOptions, thrownError) {
			alert('An error occurred! ' + thrownError);
		},
	});
	
	$('#implements').removeClass("active");
	$('#transitions').removeClass("active");
	$('#cop').removeClass("active");
	$('#foro').addClass("active");
};





